How to Reset the Password of GitLab Root User

This post will guide you to reset password for GitLab root user using command lines if you forget its password. There are two methods to reset the password.

Method 1 Reset password using a rake task

In the Shell/SSH, execute the command below and enter the new password twice:

# gitlab-rake 'gitlab:password:reset[root]'

Alternatively, you can reset password using the following command:

# gitlab-rake "gitlab:password:reset[root]" << EOF
{Your-new-password}
{Your-new-password}
EOF

Method 2 Reset password using a Rails console

Execute command below one by one:

# gitlab-rails console
# user = User.find_by_username 'root'
# user.password = "Your-new-password"
# user.password_confirmation = "Your-new-password"
# user.send_only_adm in_changed_your_password_notification!
# user.save!
# exit 
Copyright © 2022 Cloud Clusters Inc. all right reserved,powered by GitbookRevised on 05/31/2022

results matching ""

    No results matching ""